package com.chenzhengrong.demospringboot.controlloer;

import com.chenzhengrong.demospringboot.domain.R;
import com.chenzhengrong.demospringboot.util.WeatherUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author chenzhengrong
 * @title: WeatherController
 * @description: 天气获取 接口
 * @date 2022/10/13 11:51
 */
@RestController
@RequestMapping("/api")
public class WeatherController {

    @Autowired
    private WeatherUtils weatherUtils;

    /**
    * @description: 获取天气详细信息
    * @author chenzhengrong
    * @date 2022/10/13 14:03
    */
    @GetMapping("/weatherInfo")
    public R getweatherInfo() {
        return R.ok(weatherUtils.getWeatherInfo());
    }

    /**
    * @description: 获取实时空气质量
    * @return com.chenzhengrong.demospringboot.domain.R
    * @author chenzhengrong
    * @date 2022/10/13 16:32
    */
    @GetMapping("/weatherQuality")
    public R getWeatherQuality() {
        return R.ok(weatherUtils.getWeatherQuality());
    }

}
